package com.example.waternetwork.api.supervision.controller;

import com.example.waternetwork.api.model.R;
import com.example.waternetwork.api.supervision.entity.BaseReservoirDispatchPlan;
import com.example.waternetwork.api.supervision.entity.PlanInfoVo;
import com.example.waternetwork.api.supervision.service.IBaseReservoirDispatchPlanService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;


/**
 * <p>
 * 水库调度方案基础信息表 前端控制器
 * </p>
 *
 * @author auto gen
 * @since 2025-07-02
 */
@RestController
@RequestMapping("/supervision/baseReservoirDispatchPlan")
@Tag(name = "水库调度方案基础信息管理", description = "提供根据水库编码或ID查询调度方案基础信息等功能")
public class BaseReservoirDispatchPlanController {
    @Autowired
    private IBaseReservoirDispatchPlanService baseReservoirDispatchPlanService;

    @GetMapping("/getPlanListByResCode")
    @Operation(
        summary = "根据水库编码获取调度方案列表",
        description = "通过提供的水库编码，查询并返回对应的调度方案基础信息列表。",
        responses = {
            @ApiResponse(responseCode = "200", description = "成功获取调度方案列表", content = @Content(schema = @Schema(implementation = R.class))),
            @ApiResponse(responseCode = "400", description = "参数为空")
        }
    )
    public R<List<BaseReservoirDispatchPlan>> getPlanListByResCode(@Parameter(description = "水库唯一编码，用于查询对应的调度方案信息", required = true) @RequestParam String code) {
        return R.ok(baseReservoirDispatchPlanService.getPlanListByResCode(code));
    }


    @GetMapping("/getPlanInfoById")
    @Operation(
        summary = "根据调度方案ID获取详细信息",
        description = "通过提供的调度方案ID，查询并返回对应的调度方案详细信息。",
        responses = {
            @ApiResponse(responseCode = "200", description = "成功获取调度方案详情", content = @Content(schema = @Schema(implementation = R.class))),
            @ApiResponse(responseCode = "400", description = "参数为空")
        }
    )
    public R<PlanInfoVo> getPlanInfoById(@Parameter(description = "调度方案的唯一标识", required = true) @RequestParam Long id) {
        return R.ok(baseReservoirDispatchPlanService.getPlanInfoById(id));
    }

}
